package MCQReaderInterface;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class MCQReaderNavigator extends JPanel{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JButton previousBtn;
	private JButton nextBtn;
	private JLabel indexPage;
	
	MCQReaderNavigator(){
		previousBtn = new JButton("previous");
		nextBtn = new JButton("next");
		
		previousBtn.setEnabled(false);
		nextBtn.setEnabled(false);
		indexPage = new JLabel();
		
		indexPage.setText(" / ");
		
		
		previousBtn.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent arg0) {
				MainInterface.thisIsIt.getRightFrame().getPdfDisplay().previousPage();
			}
		});
		
		nextBtn.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent arg0) {
				MainInterface.thisIsIt.getRightFrame().getPdfDisplay().nextPage();
			}
		});
		
		add(previousBtn);
		add(indexPage);
		add(nextBtn);
	}

	public void OpenPDF(int nbPages){
		if(nbPages > 1)
			nextBtn.setEnabled(true);		
		indexPage.setText("1 / " + nbPages);
	}
	
	public JButton getPreviousBtn() {
		return previousBtn;
	}

	public JButton getNextBtn() {
		return nextBtn;
	}

	public JLabel getIndexPage() {
		return indexPage;
	}

}
